<template>
  <div id="operationalAudit">
    <ReturnPage />
    <!-- 搜索条件 -->
    <el-form :inline="true" :model="query" size="mini" class="demo-form-inline" style="margin-top: 18px">
      <el-form-item label="系统模块" prop="title">
        <el-input v-model="query.title" placeholder="请输入系统模块" clearable style="width: 240px" />
      </el-form-item>
      <el-form-item>
        <el-button class="ml10" size="mini" type="primary" @click="handleQuery">查询</el-button>
      </el-form-item>
    </el-form>
    <!-- 列表 -->
    <div class="tp_box">
      <el-table :data="tableData" style="width: 100%" height="calc(100vh - 300px)" :cell-style="cellStyle">
        <el-table-column prop="title" label="系统模块"> </el-table-column>
        <el-table-column prop="businessType" label="操作类型">
          <template slot-scope="scope">
            <el-tag size="mini">
              {{ scope.row.businessType | getSeverity }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="requestMethod" label="请求方式">
        </el-table-column>
        <el-table-column prop="operName" label="操作人员"> </el-table-column>
        <el-table-column prop="operTime" label="操作日期"> </el-table-column>
      </el-table>
      <pagination v-show="total > 0" :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize"
        @pagination="getListData()" />
    </div>
  </div>
</template>

<script>
import { getAuditApi } from "@/api/automated/instrumentPanel";
import Template from "../../../ConfigurationManagement/model/Template.vue";
export default {
  components: { Template },
  data() {
    return {
      // 数据条数
      total: 0,
      //分页数据
      query: {
        pageNum: 1, //页码
        pageSize: 10, //页数
        grade: "", //严重性等级
        title: undefined,
        // auditType: 1,
      },
      //表格数据
      tableData: [],
    };
  },
  methods: {
    //获取数据
    getListData() {
      console.log(this.query);
      getAuditApi(this.query).then((res) => {
        if (res.code == 200) {
          this.tableData = res.rows;
          this.total = res.total;
        }
      });
    },
    //查询
    handleQuery() {
      this.query.pageNum = 1;
      this.getListData();
    },
  },
  created() {
    this.getListData();
  },
  filters: {
    //过滤严重性
    getSeverity(val) {
      switch (val) {
        case 0:
          return "其它";
        case 1:
          return "新增";
        case 2:
          return "编辑";
        case 3:
          return "删除";
      }
    },
  },
};
</script>

<style lang="scss" scoped></style>